package com.dly.hope.modle;

import com.dly.hope.type.DataStatusEnum;
import com.dly.hope.type.TemplateType;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author linyu.dai
 * @project myserve
 * @description 模板
 * @creat 2022/8/28 20:27:25
 */
@Entity
@Table(name = "hope004_template")
@DynamicInsert
@DynamicUpdate

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Template implements Serializable {

    @Id
    @Column(name = "id")
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "org.hibernate.id.UUIDGenerator")
    private String id;

    @Column(name = "type")
    @Comment(value = "模板类型")
    @Enumerated(EnumType.STRING)
    private TemplateType type;

    @Column(name = "template")
    @Comment(value = "模板")
    private String template;

    @Column(name = "subject")
    @Comment(value = "主题")
    private String subject;

    @Column(name = "obj_status")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.NON_NULL)
    @Comment(value = "状态")
    private Integer dataStatus = DataStatusEnum.EFFICIENT.getCode();
}
